package com.bankscene.screenfit.adapters;


import android.support.annotation.CheckResult;

import com.bankscene.screenfit.model.Menus;
import com.bankscene.screenfit.vus.MenusGridViewItemVu;

import org.greenrobot.eventbus.EventBus;

import java.util.List;

import static com.bankscene.screenfit.model.Menus.TITLES;
import static com.bankscene.screenfit.model.Menus.VALUES;

/**
 * Created by jiiiiiin on 6/14/16.
 */
public class MenusGridViewAdapter extends BasePresenterAdapter<MenusGridViewItemVu> {

    List<String> titles = TITLES;
    List<Menus> values = VALUES;

    @Override
    protected void onBindListItemVu(int position) {
        vu.setVal(values.get(position));
    }

    @Override
    protected Class<MenusGridViewItemVu> getVuClass() {
        return MenusGridViewItemVu.class;
    }

    @Override
    public int getCount() {
        return titles.size();
    }

    @Override
    public Object getItem(int position) {
        return titles.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @CheckResult
    public Menus getMenus(int position) {
        return values.get(position);
    }

    public static MenusGridViewAdapter newInstance(EventBus bus) {
        MenusGridViewAdapter menusGridViewAdapter = new MenusGridViewAdapter();
        menusGridViewAdapter.bus = bus;
        return menusGridViewAdapter;
    }
}
